(function(window){

    var events = {

    }

    function log(msg){
        if(window.console) console.log(msg);
    }

    function define(eventType){
        if(!events[eventType])
            events[eventType] = [];
    }

    function on(eventType, callback){
        if(!events[eventType]){
            define(eventType);
        }
        events[eventType].push(callback);
    }

    function trigger(eventType){
        if(events[eventType]){
            for(var i = 0, fns = events[eventType], length = fns.length; i < length; i++){
                if(fns[i]()) break;
            }
        }
    }

    window.Event = {
        on: on,
        trigger: trigger
    };

})(window);